import { View, Image } from '@tarojs/components';
import React, { useState,useEffect } from 'react';
import Taro, { Config } from '@tarojs/taro';
import { AtDivider } from 'taro-ui';

import left from '../image/left.png';
import './message.scss';
// import right from '../image/right.png';
import NavBar from '../fit';

const Message = () => {
  const [list1, setList1] = useState([])
  //   从云数据库中把审核表中的数据进行提取
  useEffect(() => {
    Taro.cloud.callFunction({
      // 云函数名称
      name: 'enroll',
      data: {
        event: null
      }
    }).then(res => {
      setList1(res.result)
    })
  }, [])
  console.log("callback_list1:", list1)


  //跳转到具体的审核信息页面
  const handleClick1 = cont => {
    console.log("content:", cont)
    let data = JSON.stringify(cont)
    Taro.navigateTo({
      url: '/pages/my/auditing/auditing?list=' + encodeURIComponent(data),
    })
  }




  const List = list1.map(content => (
    <View className="boxbox">
      <View className="box1">
        <View className="name">{content.enroll_name}</View>
        <View className="tel">{content.enroll_phone}</View>
      </View>
      <View className="iden">{content.enroll_idCard}</View>
      <AtDivider height="40" />
      <View className="info" onClick={() => handleClick1(content)}>更多信息</View>
    </View>

  ))
  //审核表返回得跳转
  const toBack=()=>{
    Taro.navigateBack().then();
  }

  return (
    <View className="box">
      <NavBar
        title="营养师信息"
        // color="#ffffff"
        back={true}
        nback={toBack}
        // home={true}
        // onHome={toHome}

      />
      {List}

    </View>

  )
}
export default Message
